package com.tank.dwr;

import java.util.List;

import org.directwebremoting.annotations.RemoteMethod;
import org.directwebremoting.annotations.RemoteProxy;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;

import com.tank.bean.User;
import com.tank.bean.item.Comment;
import com.tank.bean.item.Item;
import com.tank.bean.item.Talk;
import com.tank.bean.item.Transpond;
import com.tank.core.TankModel;
import com.tank.service.HomeService;
import com.tank.service.ItemService;
import com.tank.util.TankUtil;

@RemoteProxy(name="HOME")
public class HomeController {
	
	@Autowired
	@Qualifier("itemService")
	ItemService itemS;
	
	@Autowired
	@Qualifier("homeService")
	HomeService homeS;
	
	
	@RemoteMethod
	public TankModel favour(Item item){
		return itemS.favour(item);
	}
	
	@RemoteMethod
	public Talk addTalk(Talk talk){
		return itemS.addTalk(talk);
	}
	
	@RemoteMethod
	public Transpond addTranspond(Transpond transpond){
		return itemS.addTranspond(transpond);
	}
	
	@RemoteMethod
	public Comment addComment(Comment comment){
		System.out.println("pid="+comment.getParent().getId());
		return itemS.addComment(comment);
	}
	
	@RemoteMethod
	public TankModel findComments(int itemId,int pageNo,int pageSize){
		System.out.println("itemId="+itemId+",pageNo="+pageNo);
		return itemS.findComments(itemId,pageNo,pageSize);
	}
	
	
	
	
	
}
